/////  Talk to the Priest

begintalkscript;

variables;

// Father Kernighan.
// Nodes 1-8
// States 1-4

begintalknode 1;
	state = -1;
	condition = 1;
	nextstate = 1;
	question="Father Kernighan";
	personality = 3;
	action = INTRO;
	text1 = "This priest has his cowl drawn over his head and appears deeply lost in thought, sitting in front of a large mug. However, after a few moments he grows aware that you are looking at him, and looks you in the eyes.";
	text2 = "_Good evening, children,_ he addresses you kindly. _I am Father Kernighan._ His voice is warm and kind.";	
	text3 = "_I see you have come from far away._";
	text5 = "Father Kernighan is still sitting here, and still lost in thought. His mug of ale is still untouched - or maybe he got a refill since you last looked. He greets you again.";
	text6 = "_Should you not be resting after such a long journey?_";

begintalknode 2;
	state = 1;
	personality = 3;
	question="How did you know we were travelers?";
	text1="He sees the look in your eyes and sounds amused.";
	text2="_Backus is a way station. You are not a local farmer, so you must be passing through._ He turns his head to look outside, through the window.";
	text3="_Your horses look exhausted. You have been riding for more than a day, and quickly. Where do you need to be so urgently?_";
	nextstate=2;

begintalknode 3;
	state = 1;
	personality = 3;
	question="And what journey brings you to such a remote place, Father?";
	text1="_Not remote for me. I am returning home, in fact._";
	text2="_I serve in a monastery not far from here. My order dedicates itself to study, and I have spent several months on a research expedition, attempting to recover several rare tomes that we long thought lost to the world._";
	nextstate=3;

begintalknode 4;
	state = 2;
	personality = 3;
	condition = get_flag(0,0)==0; // blabbered?
	question = "We carry an Imperial message of great importance.";
	text1="_Imperial courier service? I've never seen your faces here before, but it figures that the old postman couldn't keep on forever..._ he trails off.";
	text3="_You look very thirsty,_ he continues after a pause. Turning over to the barkeeper, he calls out: _A round of ale for a few weary travelers, if you would please!_";
	text4="Within a few moments, the barkeeper has arrived at your table with several large pint mugs. Something about Father Kernighan's bearing tells you that he could do this every day without putting a dent in his travel allowance.";
	action = SET_SDF 0 0 1;
	code = 
		set_char_status(1000,28,4,0,1);
	break;

begintalknode 5;
	state = 2;
	personality = 3;
	condition = get_flag(0,0)==0; // blabbered?
	question = "We are not really at liberty to say.";
	text1="He looks at you for several moments, as if trying to read your minds.";
	text2="_Is that so._";
	text3="_You look very thirsty,_ he continues after a pause. Turning over to the barkeeper, he calls out: _A round of ale for a few weary travelers, if you would please!_";
	text4="Within a few moments, the barkeeper has arrived at your table with several large pint mugs. Something about Father Kernighan's bearing tells you that he could do this every day without putting a dent in his travel allowance.";
	action = SET_SDF 0 0 2;
	code = 
		set_char_status(1000,28,4,0,1);
	break;

begintalknode 6;
	state = 3;
	personality = 3;
	question="Study? Could you teach us magic?";
	text1="He chuckles for a few moments.";
	text2="_The magic we study is not for the common adventurer, and would not be much use to you, I fear._";
	text3="_In fact, only a small part of our lore is actually concerned with wizardry. The rest is history, geography, and science._";
	text4="_If you wish to learn the kind of magic that is useful for your travels, I would direct you instead to the libraries of Moon to the north, and Lorelei to the south. They have plenty of books concerned with the study of magic._";
	text5="_But wait. You look young and inexperienced, and I would not mind some extra income. I can teach you a few of the most basic rituals._";
	nextstate = 4;

begintalknode 7;
	state = 3;
	personality = 3;
	question="What are those tomes concerned with?";
	text1="_Even if I was allowed to tell you, it would not do you any good._ He smiles a somewhat superior smile.";
	text2="_Ancient cultures that have long fallen. Dead languages and rituals. More than that would really be too much to say._";

begintalknode 8;
	state = 4;
	personality = 3;
	question = "Oh yes, please do.";
	text1="Father Kernighan teaches you some of the most basic holy rituals. Unsurprisingly, he has mastered them to a high degree and has a lot to teach you in spite of their simplicity.";
	code = 
		begin_shop_mode("Kernighan's Rituals","Father Kernighan's order is above petty cantrips, but he can teach fairly advanced knowledge of basic rituals.",
				6,5,-1);
		

	break;

// Now the innkeeper

begintalknode 9;
	state = -1;
	personality = 4;
	nextstate=5;
	question="Innkeeper";
	action=INTRO;
	text1="The innkeeper of Backus is an elderly chap who must have run this place for a few decades.";
	text2="He has nonetheless lost none of his vigor, and moves about like a man half his age. He looks up from the basin in which he is washing the glasses, and addresses you.";
	text3="_Greetings, travelers. Call me Ritchie. Welcome to the Thirsty Herald!_";
	text4="Rooms are 20 gold, beer is 5. I also have rations, if you need any.";
	text5="_Hello again, travelers,_ Ritchie greets you. _How can I help you?";
	text6="Rooms are 20 gold, beer is 5. I also have rations, if you need any_.";

begintalknode 10;
	state = 5;
	personality = 4;
	question="A round of ale please, Ritchie.";
	text1="Within no time at all, you are all sipping at large tankards of beer. For such a backwater, it is surprisingly pleasant.";
	text3="Ritchie appears to be a nice guy, but no innkeeper does freebies. For the moment, your finances dictate sobriety.";
	nextstate=6;
	action = PAY -1 -1 -1 5;

begintalknode 11;
	state = 5;
	personality = 4;
	question="We would like to buy some food.";
	text1="You conclude your business.";
	code = 
		begin_shop_mode("Ritchie's Rations","Ritchie's food is made to last on a journey, and accordingly not luxurious. But as rations go, they look tasty.",
				5,1,-1);
	break;

begintalknode 12;
	state = 5;
	personality = 4;
	question="We need a room for the night.";
	action = INN 20 6 20;
	text1 = "You have not traveled far, but you immediately get the sense that you won't often see an inn with rooms this nice.";
	text2 = "You settle down for a very restful sleep.";
	text3 = "Unfortunately, you do not have the gold to rent a room here. If you don't find a source of income on short notice, you will spend the night camping outside.";
	text5 = "_I'm sorry, but my rooms are not for horses. Keep them outside, please. There's a hitching post right outside the door._";
	code =
		if (get_flag(200,1)==0) set_flag(0,3,1); // message not yet stolen? stal it.
	break;
	
begintalknode 13;
	state = 6;
	personality = 4;
	question = "Why is your beer so good?";
	text1="Ritchie beams at the compliment. _I am glad you like it._";
	text2="_Old family recipe. I brew it myself; the brewery is in the cellar._";
	text3="_This inn has been run by my family for nearly a century, ever since it was established as a horse-changing station for Imperial couriers._";
	text4="_I could tell you plenty of tales. Valorim was a wild and untamed place back then. You know Claw, at the Inn of Blades? Always been my hero. We had it pretty rough up here, too._";

// Now the assassin. nodes 14-15, state 7.

begintalknode 14;
	state = -1;
	personality=5;
	question="Zak";
	action=INTRO;
	text1 = "A hard-looking man is sitting at the table here. He seems very focused and deceptively calm, ready to jump in an instant.";
	text2 = "Though his eyes hardly leave the glass of water in front of him, he is aware of all that moves in the room.";
	text3 = "As you approach, he pretends to concentrate on his drink even more, to avoid talking to you. When that doesn't work, he grudgingly looks up.";
	text4 = "_What do you want._";
	text5 = "Zak notices you approaching and is annoyed. _Yes._";
	nextstate = 7;

begintalknode 15;
	state = 7;
	personality=5;
	question="Who are you?";
	text1="_Zak._";
	text2="He turns back to his water, the conversation apparently over.";

// Now the lady. nodes 16-19, states 8-9.

begintalknode 16;
	state= -1;
	action=INTRO;
	personality=6;
	question="Lenore";
	text1="Next to the aging priest and the gruff soldier, this young woman looks quite out of place.";
	text2="She too is wearing the gear of a traveler. Unlike the other two, however, she appears rested and even cheerful.";
	text3="_Hi. I am Lenore. From the college._";
	text5="_Hi again,_ Lenore greets you. _Anything else I can help with?_";
	nextstate=8;

begintalknode 17;
	state = 8;
	question="Where are you going?";
	text1="_I'm going north to visit the Citadel._";
	text2="_It is a very expansive library, founded by an Order of... oh, they're hard to explain. But they gather knowledge, and I was hoping that they might help me out with something._";
	text3="She mutters under something under her breath that sounds like _damn differential equations_.";

begintalknode 18;
	state = 8;
	question="What college?";
	text1="_Redmark College in the City of Dawn, quite a way to the southeast._ You've heard of it. It has only been around for twenty years or so, and was founded by Avernites.";
	text2="_I teach mathematics there._ Now that you take a closer look at her face, you can see even in the bad light that her skin is very pale.";
	text3="She must be from Avernum herself.";
	nextstate = 9;

begintalknode 27;
	state = 8;
	question="You don't seem tired at all. Haven't you traveled far today?";
	text1="_Today? No, I only just got up._ She points at the plate in front of her. _This is breakfast, not dinner. I'm getting ready to leave soon, in fact._";
	text2="_I got used to a nocturnal cycle, see,_ she explains. _It's the most convenient for us cavern-dwellers. Sometimes awkward for when dealing with surfacers, but there you go._";
	text3="_Can you imagine I had to have Ritchie wake me in the middle of the day today just so I could buy a few arrows? I really long for the shift-operated stores back in Avernum..._";
	text4="She laughs. _And I'm not the only one. You should visit Dawn one day. You'd swear it was a city of vampires. Some of our professors at Redmark only lecture at night, too._";


begintalknode 19;
	state = 9;
	question="You are an Avernite?";
	text1="_By birth, yes. In fact, I am a second generation Avernite; my parents were born in the caverns themselves._";
	text2="_I only came up here after they died. Dawn was really the only place one could live without sticking out, so that's where I moved to._";

// now Grace, nodes 20-22, state 10

begintalknode 20;
	state = -1;
	personality=6;
	action=INTRO;
	question="Grace";
	text1="A middle-aged woman is sitting behind the counter, carefully trimming a few feathers on a narrow shaft of wood. She interrupts her fletching to greet you.";
	text2="_Welcome to Hopper's Archery Supplies! I'm Grace. Can I help you with anything feathered and pointy?_";
	text3="_I can also buy any spare goods you may have. The traders that pass through here will pay for anything._";
	text5="_Welcome back,_ Grace greets you. _Anything else I can help with?_";
	nextstate = 10;

begintalknode 21;
	state = 10;
	question = "I would like to buy some arrows.";
	text1 = "You conclude your business.";
	code = 
		begin_shop_mode("Hopper's Archery Supplies","Grace has fairly high-quality work, and even though it's a notch more expensive than usual, the goods are affordable. She also pays handsomely for your items.",
				7,4,3);
	break;

begintalknode 22;
	state = 10;
	question = "Do you know anyone who could identify my things?";
	text1="_Heavens above! This is a way station, not a bazaar. I'm sure you will have some luck at Lorelei, it's barely a day's journey from here._";
	text2="_I'm lucky I can keep even my little shop open. Vojtech used to sell spanning trees in a shop right across the village square from here, but he went out of business. Not enough customers. The art of botany is lost on the locals here._";
	text3="_It seems that ammunition is the only product that travelers will need constantly._";

// now Ritchie, after you slept


begintalknode 23;
	state = -1;
	action=DEP_ON_SDF 0 4 0;
	question="Guess what happened!";
	text1="Ritchie appears to have risen early. He is already behind the counter, ordering some dishes and counting out yesterday's earnings.";
	text2="He looks up as you enter the common room. _Good morning! Had a restful sleep?_";
	text3="_Uh, hello_, Ritchie mutters, looking at you hesitantly and embarrassed. Having someone robbed right under your nose in your tavern can do that to you.";
	code = 
		set_flag(0,4,1);
	break;
	nextstate = 5;

begintalknode 24;
	state = 5;
	condition = get_flag(0,5) == 0 && get_flag(0,4)==1 && get_flag(0,7)!=2;
	action = SET_SDF 0 5 1;
	question="We got robbed in that room last night!";
	text1="He is stunned. For a moment he can't say anything. His lips work in silence, then he speaks.";
	text2="_If I can reimburse---_";
	text3="You cut him off and explain the situation. The message cannot be replaced, obviously. If you cannot deliver it, you face a very long time in prison indeed - if you are lucky, that is.";
	text4="The only possible solution lies in quick recovery of the lost courier pouch.";
	nextstate = 11;

begintalknode 25;
	state=11;
	question="Have you seen anyone suspicious near our room last night?";
	text1="_Not that I can think, no._ He trails off, in thought.";
	text2="_You went to bed earlier than the others, right? Kernighan went soon after you, he had the room upstairs from yours. That soldier slept next door._";
	text3="_Lenore left at nightfall. Apparently she prefers to travel by darkness; Avernites get sunburned easily._";
	text4="_I have to confess I don't know any more, because I went to sleep soon afterward myself. You did lock the door, I trust?_ You assure him you did.";
	nextstate = 12;

begintalknode 26;
	state = 12;
	question="Someone unlocked it. It was ajar this morning.";
	text1="_This gets worse and worse,_ Ritchie laments. _The doors are supposed to be completely secure against lock-picks. There's no way anyone could have gotten in without smashing it open or using the key._";
	text2="He checks his belt. _It is as I feared,_ he says grimly. _Someone stole my key. They must be fairly nimble, because I sleep lightly. I lock my door too, of course, but I sleep with a window open. One of my little failings..._ he trails off, wretchedly.";
	text3="_I am afraid I cannot do anything more to help you._ He is correct, too. Almost all inns disclaim responsibility for burglaries. Under Imperial Law, it is you and not he who will suffer the consequences of this loss.";
	text4="_I do know there is a goblin infestation a few hours west of Backus, which has given us trouble a few times, but... you know goblins._";
	text5="_I would be surprised if they managed to find this inn without a map, let alone break into it. And what would they do with a message, of all things?_";
	nextstate=13;


begintalknode 28;
	state = -1;
	question="Father Kernighan, returned";
	action=INTRO;
	text1="Kernighan is sitting at his place, quietly sipping at his ale as if nothing was wrong. He manages to pull it off quite convincingly.";
	text2="He pretends not to have noticed you, but when you're standing practically in front of him, he has little choice.";
	text3="Looking surprised, he greets you. _Hello again, young travelers._";
	text5="Kernighan is still sitting here, acting with great restraint - as are you.";
	nextstate = 14;

begintalknode 29;
	state=14;
	question = "Why did you steal our message?";
	action = DEP_ON_SDF 0 0 2;
	text1="_Your what? Excuse me, I have no idea what message you are talking about._";
	text2="_Is that what you meant when you said you were traveling in a secret mission? Why do you think I have done anything to impede your mission, when I did not even know of it?";
	text3="_Your message? Believe me, I would never dare to mess with the Imperial Postal service. Why ever do you think I have misappropriated your courier pouch?";
	nextstate = 15;

begintalknode 30;
	state=15;
	question="Because we saw you plant it in the goblin lair";
	text1="_That must surely be a mistake. You saw me where? In some lonely cave deep underground? I have traveled to the northwest to bring books to my Order._";
	text2="_I am returning only now to retrieve more. I could never have had time to go into some goblin lair._";
	text3="His alibi is ridiculously flimsy, and you did, after all, see his apparition. You have a good mind to stick him right here and now. Unfortunately, Ritchie is standing behind the counter and would probably object to violence without clear justification.";
	nextstate = 16;

begintalknode 31;
	state = 16;
	question = "How curious. Then how do you imagine this could have ended up there? (Show pouch)";
	text1="Kernighan smiles. _You found it! Then where is the problem? Why do you feel the need to make baseless accusations now that you have retrieved what you lost?_";
	text2="_Quick, quick, deliver it! Isn't it true that every day costs you hundreds of gold coins in bonus payment?_";
	nextstate = 17;

begintalknode 33;
	state = 5;
	condition = get_flag(0,7)==2; // only if we fought Kerny (and presumably reentered, since Ritchie vanished)
	question="You're a bloody coward, Ritchie.";
	text1="_Hey now!_ Ritchie protests. _You saw what that man was capable of. What do you think I should have done?_ But he looks uncomfortable as he says it.";
	text2="You decide to leave him alone with his shame.";
	action=END_TALK;

begintalknode 32;
	state = 17;
	condition=get_flag(2,5)==1;
	question="Cute. But we happen to know this message is a fake.";
	text1="It was a total shot in the dark. Of course you knew from Kernighan's recording that it was not the real message, but you are surprised by the effect of your words.";
	text2="Kernighan's calm demeanor evaporates instantly.";
	text3="_Prove it._ He hisses. But his words are rhetorical. For in the very same moment, he is already waving his hand in a complex motion. Several sendings appear in the room, eager for blood. He attacks.";
	action = END_TALK;
	code =
		set_flag(0,7,1);
	break;

